package com.cloudkeeper.leasing.identity.service.impl;

import com.cloudkeeper.leasing.base.repository.BaseRepository;
import com.cloudkeeper.leasing.base.service.impl.BaseServiceImpl;
import com.cloudkeeper.leasing.identity.domain.VillageCadresTemporary;
import com.cloudkeeper.leasing.identity.repository.VillageCadresTemporaryRepository;
import com.cloudkeeper.leasing.identity.service.VillageCadresTemporaryService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.stereotype.Service;

/**
 * 村干部临时表 service
 * @author asher
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class VillageCadresTemporaryServiceImpl extends BaseServiceImpl<VillageCadresTemporary> implements VillageCadresTemporaryService {

    /** 村干部临时表 repository */
    private final VillageCadresTemporaryRepository villageCadresTemporaryRepository;

    @Override
    protected BaseRepository<VillageCadresTemporary> getBaseRepository() {
        return villageCadresTemporaryRepository;
    }

    @Override
    public ExampleMatcher defaultExampleMatcher() {
        return super.defaultExampleMatcher()
                .withMatcher("cadresInfo", ExampleMatcher.GenericPropertyMatchers.contains())
                .withMatcher("statue", ExampleMatcher.GenericPropertyMatchers.contains());
    }

    @Override
    public VillageCadresTemporary findByCadresId(String cadresId) {
        return villageCadresTemporaryRepository.findByCadresId(cadresId);
    }
}
